using System;
using System.Collections.Generic;
using System.Windows;
using Microsoft.Phone.Shell;

namespace WindowsPhoneEssentials.Abstractions
{
    public class PhoneApplicationServiceWrapper : IPhoneApplicationService
    {
        private readonly PhoneApplicationService phoneApplicationService;

        public PhoneApplicationServiceWrapper(PhoneApplicationService phoneApplicationService)
        {
            this.phoneApplicationService = phoneApplicationService;
        }

        public void StartService(ApplicationServiceContext context)
        {
            phoneApplicationService.StartService(context);
        }

        public void StopService()
        {
            phoneApplicationService.StopService();
        }

        public IdleDetectionMode UserIdleDetectionMode
        {
            get { return phoneApplicationService.UserIdleDetectionMode; }
            set { phoneApplicationService.UserIdleDetectionMode = value; }
        }

        public IdleDetectionMode ApplicationIdleDetectionMode
        {
            get { return phoneApplicationService.ApplicationIdleDetectionMode; }
            set { phoneApplicationService.ApplicationIdleDetectionMode = value; }
        }

        public IDictionary<string, object> State
        {
            get { return phoneApplicationService.State; }
        }

        public StartupMode StartupMode
        {
            get { return phoneApplicationService.StartupMode; }
        }

        public event EventHandler<LaunchingEventArgs> Launching
        {
            add { phoneApplicationService.Launching -= value; }
            remove { phoneApplicationService.Launching -= value; }
        }

        public event EventHandler<ActivatedEventArgs> Activated
        {
            add { phoneApplicationService.Activated += value; }
            remove { phoneApplicationService.Activated -= value; }
        }

        public event EventHandler<DeactivatedEventArgs> Deactivated
        {
            add { phoneApplicationService.Deactivated += value; }
            remove { phoneApplicationService.Deactivated -= value; }
        }

        public event EventHandler<ClosingEventArgs> Closing
        {
            add { phoneApplicationService.Closing += value; }
            remove { phoneApplicationService.Closing -= value; }
        }
    }
}
